function numberOfBeams(bank) {
  // 存储每行中'1'的数量
  const counts = [];
  for (const row of bank) {
    let cnt = 0;
    for (const c of row) {
      if (c === "1") {
        cnt++;
      }
    }
    if (cnt > 0) {
      counts.push(cnt);
    }
  }
  // 计算激光束总数
  let total = 0;
  for (let i = 1; i < counts.length; i++) {
    total += counts[i - 1] * counts[i];
  }
  return total;
}
